﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

/// <summary>
/// Sysconfig 的摘要说明
/// </summary>
public class Sysconfig
{
    private string maintitle; //主标题
    public string Maintitle {
        get { return maintitle; }
        set { maintitle = value; }
    }

    private string mainkeywords;  //主关键字
    public string Mainkeywords
    {
        get { return mainkeywords; }
        set { mainkeywords = value; }
    }

    private string dzswtitle; //电子商务标题
    public string Dzswtitle
    {
        get { return dzswtitle; }
        set { dzswtitle = value; }
    }

    private string dzswkeywords;  //电子商务关键字
    public string Dzswkeywords
    {
        get { return dzswkeywords; }
        set { dzswkeywords = value; }
    }

    private string rdgctitle;  //弱电工程标题
    public string Rdgctitle
    {
        get { return rdgctitle; }
        set { rdgctitle = value; }
    }

    private string rdgckeywords; //弱电工程关键字
    public string Rdgckeywords
    {
        get { return rdgckeywords; }
        set { rdgckeywords = value; }
    }

    private string twzztitle; //图文制作标题
    public string Twzztitle
    {
        get { return twzztitle; }
        set { twzztitle = value; }
    }

    private string twzzkeywords; //图文制作关键字
    public string Twzzkeywords
    {
        get { return twzzkeywords; }
        set { twzzkeywords = value; }
    }

    private string description;//公司描述
    public string Description
    {
        get { return description; }
        set { description = value; }
    }

    public const string GETSYSCONFIG = "select * from sysconfig";

    public const string UPDATESYSCONFIG = "update sysconfig set maintitle=@maintitle,mainkeywords=@mainkeywords,dzswtitle=@dzswtitle,dzswkeywords=@dzswkeywords,rdgctitle=@rdgctitle,rdgckeywords=@rdgckeywords,twzztitle=@twzztitle,twzzkeywords=@twzzkeywords,description=@description";


    public DataTable GetSysConfig()
    {
        DataTable dt = new DataTable();
        SqlHelper.FillDataTable(GETSYSCONFIG,dt);
        return dt;
    }

    public void UpdateSysConfig(Sysconfig s)
    {
        SqlHelper.ExecuteNonQuery(UPDATESYSCONFIG,
            new SqlParameter("@maintitle",s.Maintitle),
            new SqlParameter("@mainkeywords",s.Mainkeywords),
            new SqlParameter("@dzswtitle",s.Dzswtitle),
            new SqlParameter("@dzswkeywords",s.Dzswkeywords),
            new SqlParameter("@rdgctitle",s.Rdgctitle),
            new SqlParameter("@rdgckeywords",s.Rdgckeywords),
            new SqlParameter("@twzztitle",s.Twzztitle),
            new SqlParameter("@twzzkeywords",s.Twzzkeywords),
            new SqlParameter("@description",s.Description));
    }

    public static string GetMainTitle()
    {
        DataTable dt = new DataTable();
        string maintitle;
        SqlHelper.FillDataTable(GETSYSCONFIG,dt);
        maintitle = dt.Rows[0]["maintitle"].ToString();
        return maintitle;
    }

    public static string GetMainKeyWords()
    {
        DataTable dt = new DataTable();
        string mainkeywords;
        SqlHelper.FillDataTable(GETSYSCONFIG, dt);
        mainkeywords = dt.Rows[0]["mainkeywords"].ToString();
        return mainkeywords;
    }

    public static string GetDzswTitle()
    {
        DataTable dt = new DataTable();
        string dzswtitle;
        SqlHelper.FillDataTable(GETSYSCONFIG, dt);
        dzswtitle = dt.Rows[0]["dzswtitle"].ToString();
        return dzswtitle;
    }

    public static string GetDzswKeyWords()
    {
        DataTable dt = new DataTable();
        string dzswkeywords;
        SqlHelper.FillDataTable(GETSYSCONFIG, dt);
        dzswkeywords = dt.Rows[0]["dzswkeywords"].ToString();
        return dzswkeywords;
    }

    public static string GetRdgcTitle()
    {
        DataTable dt = new DataTable();
        string rdgctitle;
        SqlHelper.FillDataTable(GETSYSCONFIG, dt);
        rdgctitle = dt.Rows[0]["rdgctitle"].ToString();
        return rdgctitle;
    }

    public static string GetRdgcKeyWords()
    {
        DataTable dt = new DataTable();
        string rdgckeywords;
        SqlHelper.FillDataTable(GETSYSCONFIG, dt);
        rdgckeywords = dt.Rows[0]["rdgckeywords"].ToString();
        return rdgckeywords;
    }

    public static string GetTwzzTitle()
    {
        DataTable dt = new DataTable();
        string twzztitle;
        SqlHelper.FillDataTable(GETSYSCONFIG, dt);
        twzztitle = dt.Rows[0]["twzztitle"].ToString();
        return twzztitle;
    }

    public static string GetTwzzKeyWords()
    {
        DataTable dt = new DataTable();
        string twzzkeywords;
        SqlHelper.FillDataTable(GETSYSCONFIG, dt);
        twzzkeywords = dt.Rows[0]["twzzkeywords"].ToString();
        return twzzkeywords;
    }

    public static string GetDescription()
    {
        DataTable dt = new DataTable();
        string description;
        SqlHelper.FillDataTable(GETSYSCONFIG, dt);
        description = dt.Rows[0]["description"].ToString();
        return description;
    }

}
